<template>
	<view>
		<view v-for="item in list" :key="item.subscribeId">
			<view class="class">
				<view class="classInfo">
					<view class="classInfoItem">
						<text>姓名：</text>
						<text>{{ item.traineeName }}</text>
					</view>
					<view class="classInfoItem">
						<text>课程状态：</text>
						<text v-if="item.state == 0">待确认</text>
						<text v-if="item.state == 1">已确认</text>
						<text v-if="item.state == 2">已取消</text>
						<text v-if="item.state == 3">已完成</text>
					</view>
				</view>
				<view class="value_b" >
					<u--textarea placeholder="备注内容：请在这里输入" border="surround" v-model="item.remark"></u--textarea>
					
				</view>
				<view style="margin-top: 20rpx;">
					<u-button type="primary" text="确定"  @click="onConfirMorder(item)"></u-button>
				</view>
			</view>


		</view>
	</view>
</template>

<script>
import { coachIdList, confirMorder } from '../../common/api'
export default {
	data() {
		return {
			userData: uni.getStorageSync('userData'),
			list: [
				// {
				// 	subscribeId: 1,
				// 	traineeName: 'abc'
				// }
			],
		}
	},
	onLoad(o) {
		this.getCoachIdList()
	},
	methods: {
		async getCoachIdList() {
			console.log(1111);

			let res = await coachIdList(this.userData.user.coachId)
			console.log(res, 222);
			this.list = res
		},
		async onConfirMorder(item) {
			console.log(item, 1234);
			
			let res = await confirMorder(item.subscribeId, item.remark == '' ? '确认预约' : item.remark)
			console.log(res);
			uni.$u.toast('确认成功')
			this.getCoachIdList()
		}
	}
}
</script>

<style lang="scss" scoped>
.class {
	background: #f5f5f5;
	font-size: 28rpx;
	margin: 0 30rpx;
	border-radius: 12rpx;
	padding: 20rpx;
	color: #666;
	margin-bottom: 20rpx;

	.value_b {
		// display: flex;
		margin-top: 20rpx;
	}
}
</style>
